(defun
    Addition ()
    (setq blc (calcBalance))
    (if (>= blc 0)
        (return-from Addition 0)
    ) 
    (setq memAddrs (getCurContractDefParamList "cosignerAddrs"))   
    (setq threshold (getCurContractDefParam "threshold")) 
    (update threshold (Int threshold))
    (setq count 0)
    (setq sCount (sigCount))
    (setq data (getCurUnitHashToSign))
    (loop (setq i 0) (< i sCount)                               
        (progn
            (setq pk (getPK i))
            (setq sig (getAuthorSig i))
            (setq addr (getAuthorAddr i))
            (setq ret (verify pk data sig))
            (if (not ret)
                (return-from Addition 0)
            )    
            (setq signal 0)
            (for memAddr memAddrs
                (if (eq memAddr addr)
                    (update signal 1)
                )
            )
            (if signal
                (update count (+ count 1))
            )
            (update i (+ i 1))
        )
    )
    (if (< count threshold)
        (return-from Addition 0)
    ) 
    (return-from Addition 1)
)

(setq res (Addition))


(print "Result of Contract[Addition]: ")
(println res)